//
//  YDQHomeTableViewHeader.m
//  biyingqiquan
//
//  Created by LK-IOS on 2018/3/30.
//  Copyright © 2018年 LK-BYQQIOS. All rights reserved.
//

#import "YDQHomeTableViewHeader.h"

@interface YDQHomeTableViewHeader()

//分割线
@property (nonatomic , weak) UIView *lineView;
//图片
@property (nonatomic , weak) UIImageView *cateImage;
//类别
@property (nonatomic , weak) UILabel *cateLabel;

@end

@implementation YDQHomeTableViewHeader


+ (instancetype)headerViewWithTableView:(UITableView *)tableView
{
    
    static NSString *qqHomeTableViewHeader = @"YDQHomeTableViewHeader";
    YDQHomeTableViewHeader *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:qqHomeTableViewHeader];
    if (headerView == nil) {
        headerView = [[YDQHomeTableViewHeader alloc] initWithReuseIdentifier:qqHomeTableViewHeader];
    }
    return headerView;
}


-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.backgroundColor = [UIColor whiteColor];
        [self lineView];
        
        [self cateImage];
        [self cateLabel];

        
    }
    return self;
}

-(UIView *)lineView
{
    if (_lineView == nil) {
        UIView *lineView = [[UIView alloc] init];
        [self.contentView addSubview:lineView];
        lineView.backgroundColor = NumberColor(247, 247, 247);
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(self);
            make.height.equalTo(@1);
        }];
        _lineView = lineView;
    }
    return _lineView;
}

-(UIImageView *)cateImage
{
    if (_cateImage == nil) {
        UIImageView *cateImage = [[UIImageView alloc] init];
        [self.contentView addSubview:cateImage];
        cateImage.image = [UIImage imageNamed:@"homemeirizhangfu"];
        
        [cateImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.left.equalTo(self).offset(rate375(10));
        }];
        
        _cateImage = cateImage;
    }
    return _cateImage;
}

-(UILabel *)cateLabel
{
    if (_cateLabel == nil) {
        UILabel *cateLabel = [[UILabel alloc] init];
        [self.contentView addSubview:cateLabel];
        cateLabel.textAlignment = NSTextAlignmentLeft;
        cateLabel.font = [UIFont systemFontOfSize:font15ScreenWRate * LKScreenW];
        cateLabel.text = @"期权动态";
        cateLabel.textColor = [UIColor colorWithHexString:stockRed];
        
        [cateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.left.equalTo(self).offset(rate375(38));
        }];
        _cateLabel = cateLabel;
    }
    return _cateLabel;
}


@end
